import React from "react";
import { Pagination } from "antd";
export const PaginationWarpper = (props) => {
  const {
    paginationSetting: {
      showSizeChanger = false,
      showQuickJumper = false,
      defaultCurrent = 1,
      defaultPageSize = 10,
      total = 0,
      pageSizeOptions = [10, 20, 30, 50],
      hideOnSinglePage = false,
      align = 'center', // left | center | right
      size="default"
    },
    onChangePage,
  } = props;

  const onChange = (pageNum, pageSize) => {
    // console.log('e ======', pageNum, pageSize)
    onChangePage(pageNum, pageSize);
  };
  return (
    <div className="pagination" style={{textAlign: align,}}>
      <Pagination
        total={total}
        showSizeChanger={showSizeChanger}
        showQuickJumper={showQuickJumper}
        defaultCurrent={defaultCurrent}
        defaultPageSize={defaultPageSize}
        showTotal={(total) => `共 ${total} 条`}
        pageSizeOptions={pageSizeOptions}
        hideOnSinglePage={hideOnSinglePage}
        size={size}
        onChange={onChange}
      />
    </div>
  );
};

export default PaginationWarpper;
